package com.lhf.series.test.animationexample;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;

import com.lhf.series.test.animationexample.property.CategoryListActivity;


/**
 * 补间动画
 * Created by lihf on 16/9/12.
 */
public class TweenAnimationExampleActivity extends Activity {
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final Animation a = AnimationUtils.loadAnimation(this, R.anim.rotater);
        a.reset();
        final TextView rText = (TextView) findViewById(R.id.animatedText);
        rText.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                rText.startAnimation(a);
            }
        });

        final Animation aScale = AnimationUtils.loadAnimation(this, R.anim.scale);
        aScale.reset();
        final TextView scaleText = (TextView) findViewById(R.id.scaleAnimation);
        scaleText.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                scaleText.startAnimation(aScale);
            }
        });


        final Animation alphaAnimation = AnimationUtils.loadAnimation(this,R.anim.alpha);
        final TextView alphaText = (TextView) findViewById(R.id.alphaAnimation);
        alphaText.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                alphaText.startAnimation(alphaAnimation);
            }
        });


        final Animation tranlateAnimation = AnimationUtils.loadAnimation(this,R.anim.translate);
        final TextView translateText = (TextView) findViewById(R.id.translateAnimation);
        translateText.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                translateText.startAnimation(tranlateAnimation);
            }
        });
    }


    public void jumpToFramePage(View view){
        startActivity(new Intent(this,FrameAnimationActivity.class));
    }

    public void jumpToPropertyPage(View view){
        startActivity(new Intent(this,CategoryListActivity.class));
    }


}